home *** CD-ROM | disk | FTP | other *** search
- .code16gcc
-
- .globl _start
- _start:
- /* Make sure stack pointer is normalized */
- movzwl %sp,%esp
-
- /* Zero .bss */
- movw $__bss_start,%di
- xorl %eax,%eax
- movw $(_end+3),%cx
- subw %di,%cx
- shrw $2,%cx
- cld
- rep ; stosl
-
- /* Normalize the command line. At startup 0x80 = length and
- the command line starts at 0x81, but with whitespace */
- movl $0x81,%esi
- movzbw (0x80),%bx
- movb $0,(%bx,%si) /* Null-terminate the string */
- 1:
- lodsb
- dec %al /* Stop on null */
- cmp $31,%al /* Whitespace? */
- jbe 1b
- dec %si /* Unskip first character */
-
- /* Invoke _cstart */
- pushl %esi /* Pointer to command line */
- calll _cstart
-
- /* Terminate program (with error code in %al) */
- movb $0x4c,%ah
- int $0x21
- hlt
-
-